const publicStyle = { style: { width: "200px" } }
export const formOption = ref({
  inline: true,
  showResetButton: true,
})
export const fieldList = ref([
  {
    field: "shopCascade",
    slot: "ShopCascade",
    slotType: true,
  },
  {
    field: "skuRange",
    placeholder: "可批量搜索",
    type: "textarea",
    style: { width: "230px" },
    select: [
      { label: "sku", value: "sku" },
      { label: "自定义sku", value: "custom_sku" },
      { label: "渠道sku", value: "platform_sku" },
      { label: "spu", value: "spu" },
      { label: "ASIN", value: "asin" },
      { label: "商品中文名", value: "sku_cn_title string" },
    ],
  },
  {
    field: "noRange",
    placeholder: "可批量搜索",
    type: "textarea",
    style: { width: "230px" },
    selectStyle: { width: "110px" },
    select: [
      { label: "系统订单号", value: "order_sn" },
      { label: "平台订单号", value: "platform_order_sn" },
      { label: "退换货单号", value: "exchange_sn" },
    ],
  },
  {
    field: "orderRange",
    placeholder: "可批量搜索",
    type: "textarea",
    style: { width: "220px" },
    selectStyle: { width: "110px" },
    select: [
      { label: "退回追踪号", value: "exchange_tracking_number" },
      { label: "发货追踪号", value: "real_track_no" },
      { label: "物流商单号", value: "logistics_bill_num" },
    ],
  },
  {
    field: "storehouse", // TODO 接口组件
    placeholder: "退货仓库",
    type: "select",
    slot: "storehouse",
    selectStyle: { width: "120px" },
    select: [
      { label: "退货仓库", value: "exchange_warehouse_id" },
      { label: "发货仓库", value: "ship_warehouse_id" },
    ],
  },
  {
    field: "operator",
    type: "cascader",
    itemProps: { placeholder: "可批量搜索" },
    selectStyle: { width: "110px" },
    select: [
      { label: "退款操作人", value: "create_user" },
      { label: "客服人员", value: "customer_service_id" },
      { label: "运营人员", value: "sales_id" },
      { label: "审核人员", value: "reviewer_id" },
    ],
  },
  {
    field: "timeRange",
    type: "dateTimeRangeNorm",
    select: [
      { label: "创建时间", value: "apply_at" },
      { label: "审核时间", value: "review_at" },
      { label: "支付时间", value: "pay_time" },
      { label: "发货时间", value: "shipping_time" },
    ],
    style: { width: "368px" },
    options: {
      placeholder: "时间",
      data: [],
    },
  },
  {
    field: "shipping_type",
    type: "select",
    origin: "shipping_type",
    options: {
      placeholder: "发货类型",
      data: [],
    },
  },
  {
    field: "exchange_type",
    type: "select",
    origin: "order_exchange_type",
    options: {
      placeholder: "售后类型",
      data: [],
    },
  },
  {
    field: "storage_status",
    type: "select",
    origin: "order_exchange_storage_status",
    options: {
      placeholder: "入库状态",
      data: [],
    },
  },
])

export const tablecColumns = ref([
  {
    fixed: "left",
    width: 260,
    title: "订单信息",
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <VText title="退换货单号" value={row.exchange_sn} line={1} copy={true} />
            <VText title="平台/站点" value={`${row.platform}${row.site && "/" + row.site}`} line={1} />
            <VText title="店铺" value={row.shop} line={1} copy={true} />
            <VText title="系统" value={row.order_sn} line={1} type="link" copy={true} />
            <VText title="平台订单号" value={row.platform_order_sn} line={1} type="link" copy={true} />
            <VText title="发货类型" value={row.shipping_type_desc} line={1} />
          </div>
        )
      },
    },
  },
  {
    title: "商品信息",
    width: 400,
    slots: {
      default: "GoodsSlot",
    },
  },

  {
    width: 200,
    title: "单据状态",
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <p class="text-[16px] font-[600] text-[var(--base-text-color)]">{row.exchange_status_desc}</p>
            <VText title="入库状态" value={row.storage_status_desc} line={1} />
            <VText title="售后类型" value={row.exchange_type_desc} line={1} />
          </div>
        )
      },
    },
  },

  {
    width: 200,
    title: "发货信息",
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <VText title="发货仓库" value={row.shipLogistics?.ship_warehouse_name} line={1} copy={true} />
            <VText title="运输方式" value={row.shipLogistics?.transport_name} line={1} />
            <VText title="真实追踪号" value={row.shipLogistics?.real_track_no} line={1} copy={true} />
            <VText title="物流商单号" value={row.shipLogistics?.logistics_bill_num} line={1} copy={true} />
          </div>
        )
      },
    },
  },

  {
    width: 200,
    title: "退件详情",
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <VText title="退件仓库" value={row.exchange_warehouse_name} line={1} />
            <VText title="入库单号" value={row.storage_sn} line={1} />
            <div class="grid grid-cols-2">
              <VText title="收到货" value={row.stock_received} line={1} />
              <VText title="质检ok" value={row.inspection_passed} line={1} />
              <VText title="不良品" value={row.defective_product} line={1} />
              <VText title="入库" value={row.storage_quantity} line={1} />
            </div>
          </div>
        )
      },
    },
  },

  {
    width: 140,
    title: "备注信息",
    slots: {
      default: ({ row }) => {
        return (
          <div class="w-[100%]">
            <VText title="备注" value=" " />
            <VText value={row.exchange_remark} line={1} />
            {/* <div class="remark" v-html={row.exchange_remark || "-"}></div> */}
          </div>
        )
      },
    },
  },
  {
    width: 200,
    title: "操作人",
    slots: {
      default: ({ row }) => {
        return (
          <div>
            {row["sales"] && row["sales"].map((n) => <VText title={n.label} value={n.field} line={1} />)}

            <VText title="客服" value={row.customer_service} line={1} />
            <VText title="创建" value={row.create_user} line={1} />
            <VText title="审批" value={row.approve_operator} line={1} />
          </div>
        )
      },
    },
  },

  {
    width: 220,
    title: "时间",
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <VText title="支付" value={row.pay_time} line={1} />
            <VText title="创建" value={row.create_time} line={1} />
            <VText title="申请" value={row.apply_at} line={1} />
            <VText title="审批" value={row.review_at} line={1} />
            <VText title="入库" value={row.storage_at} line={1} />
          </div>
        )
      },
    },
  },
])
